﻿@using Emoney.UserTraining.Model;
@using Emoney.UserTraining.BLL;
@using Emoney.UserTraining.Comm;
@{
    Layout = null;
}
@{
    List<TrainNetwoekAndUser> tmulst = ViewBag.tmulst;
    List<Web_TrainUser> wtulst = ViewBag.wtulst;
    int index = 1;
    var uid = ViewBag.uid;
}
 <div class="tablestyle t1">
    <div class="topheader">
        <div class="tableitem" style="color: black;">
            <div class="time2">培训时间</div>
            <div class="theme411">主题</div>
            <div class="style">类型</div>
            <div class="name2">讲师</div>
            <div class="qq1">QQ提醒</div>
            <div class="status1">状态</div>
        </div>
    </div>
    @if (tmulst != null)
    {
        if(tmulst.Count>0)
        {
            foreach (var tnm in tmulst)
            {
                string style = "";
                if (index % 2 != 0)
                {
                    style = "tableitem tt6";
                }
                else
                {
                    style = "tableitem bg1 tt6";
                }
                string rel = StringTools.getTimeIsOpen(tnm.before_time.ToString(), tnm.class_date.ToString(), tnm.endDate.ToString(), tnm.Duration_date, tnm.mtg_id);
                string divid = "div" + tnm.Id;
                
            <div class="@style">
                <div class="time2"><b>@tnm.class_date.ToString("M/d")&nbsp;@string.Format("{0:t}", DateTime.Parse(tnm.class_date.ToString()))-@string.Format("{0:t}", tnm.endDate)</b></div>
                <div class="theme411">
                    @if (!string.IsNullOrEmpty(rel) && rel != "-1" && rel != "0")
                    {
                        var imgid = "img" + tnm.Id;
                        <a href="javascript:closeOrder('@tnm.orderid','0','@tnm.Id')" title="取消预约" style="text-decoration:none;" onmousemove="javascript:CancelOrderShow('@tnm.Id','1')" onmouseout="javascript:CancelOrderShow('@tnm.Id','0')">
                            <div style="color:#666;" class="del1" id="@divid">@StringTools.SubStr(tnm.mtg_name,11)</div>
                            <img id="@imgid" style="display:none" src="@StringTools.GetStaticFile("Images/Train/images/btn_close1.jpg")" class="btn"  title="取消预约"/>
                        </a>
                    }
                    else
                    {
                        <div>@StringTools.SubStr(tnm.mtg_name, 11)</div>
                    }
                </div>
                <div class="style">@tnm.meeting_type</div>
                <div class="name2">@StringTools.SubStr(@tnm.txtteachar,3)</div>
                @if (tnm.class_date > DateTime.Now)
                {
                    <div class="qq1"><a href="javascript:" class="b" id="@tnm.netid" onclick="QQTipFun('@tnm.mtg_name', '@tnm.class_date', '@tnm.mtg_id', '@ViewBag.useneme','@tnm.Id')">设置</a></div>
                }
                else
                {
                    <div class="qq1">设置</div>
                }

           
                    @if (!string.IsNullOrEmpty(rel) && rel == "-1")
                    {
                         <div class="opertion4">
                        <a href="@tnm.video_url" target="_blank" onclick="AddClickCount('videoTip','课程回放','@tnm.Id')">
                            <img src="@StringTools.GetStaticFile("Images/Train/images/btn7.jpg")"  state="true"/></a>
                             </div>
                    }
                    else if (!string.IsNullOrEmpty(rel) && rel == "0")
                    { <div class="opertion4">
                        <a href="javascript:OpenNetMeeting('@tnm.mtg_id','@ViewBag.useneme','@tnm.Id')">
                            <img src="@StringTools.GetStaticFile("Images/Train/images/btn8.jpg")"  state="true"/></a>
                        </div>
                    }
                    else
                    { <div class="opertion3">
                        @Html.Raw(rel)
                        </div>
                    }


            
            </div>
                    index++;

            }
        }
        else
        {
            <div class="notrain1" style="padding-top:170px; width:640px; height:115px; border:0;">
			    <div class="face" style="top:30px;"><img src="@StringTools.GetStaticFile("Images/Train/images/bg_face2.jpg")" alt="" /></div>
			    <span class="fs14 fw">您还未预约过任何课程！</span><br />
			    您可以通过查阅<a href="@Url.Content("~/Train/alltrain?uid=" + ViewBag.uid)" class="b" style="text-decoration:none;">“当月课表”</a>或<a href="@Url.Content("~/Train/wltrain?uid=" + ViewBag.uid)" class="b" style="text-decoration:none;">“推荐课程”</a> 选择您感兴趣的课程设置开课提醒
		    </div>
        }
    }
    else
    {
        <div class="notrain1" style="padding-top:170px; width:640px; height:115px; border:0;">
			<div class="face" style="top:30px;"><img src="@StringTools.GetStaticFile("Images/Train/images/bg_face2.jpg")" alt="" /></div>
			<span class="fs14 fw">您还未预约过任何课程！</span><br />
			您可以通过查阅<a href="@Url.Content("~/Train/alltrain?uid=" + ViewBag.uid)" class="b" style="text-decoration:none;">“当月课表”</a>或<a href="@Url.Content("~/Train/wltrain?uid=" + ViewBag.uid)" class="b" style="text-decoration:none;">“推荐课程”</a> 选择您感兴趣的课程设置开课提醒
		</div>
    }
     </div>
@*<div class="info">当前页面仅显示当前最近的 <b>@tmulst.Count</b> 条培训信息</div>*@
<div class="info">
    本月您还预约了<span class="red fw">@wtulst.Count</span> 场地面培训 
    <img src="@StringTools.GetStaticFile("Images/Train/images/btn6.jpg")" alt="查看" class="fn" id="ckdmtrain"  style ="cursor:pointer;"/>
</div>
@Html.Raw((string)ViewData["strPage"])
<script>
    function CancelOrderShow(id, type) {
        if (type == "1") {
            $("#div" + id).attr("class", "del");
            $("#img" + id).show();
        }
        else {
            $("#div" + id).attr("class", "del1");
            $("#img" + id).hide();
        }
    }
    $("#ckdmtrain").click(function () {
        var uid = "@uid";
        var count = "@wtulst.Count";
        if (count > 0) {
            art.dialog.open(www + 'Train/ckdmtrain?uid=' + uid, { id: "login5", title: false, height: "368px", width: "616px", lock: true });
            $(".aui_close").hide();
        }
        else {
            alert("本月未预约过地面培训");
            return;
        }
    });
</script>
<script>
    function setImgUrl(imgString, rStr) {
        var Result = new Array(4)
        , imgUrl = imgString;
        Result[0] = imgUrl.replace(/((.*)\/)(.*)(\.[a-zA-z]{3,5})$/, '$1');
        Result[1] = imgUrl.replace(/((.*)\/)(.*)(\.[a-zA-z]{3,5})$/, '$3');
        Result[2] = Result[1].replace(/((_over)|(_click))/, "");
        Result[3] = imgUrl.replace(/((.*)\/)(.*)(\.[a-zA-z]{3,4})$/, '$4');
        return Result[0] + Result[2] + rStr + Result[3];
    }

    $("[state=true]").mouseenter(function () {
        $(this).attr("src", setImgUrl($(this).attr("src"), "_over"));
    }).mouseleave(function () {
        $(this).attr("src", setImgUrl($(this).attr("src"), ""));
    }).mousedown(function (e) {
        $(this).attr("src", setImgUrl($(this).attr("src"), "_click"));
    }).mouseup(function (e) {
        $(this).attr("src", setImgUrl($(this).attr("src"), "_over"));
    });
</script>


